package bishi.day22_5_19;

import java.util.Scanner;

/**
 * 小易的升级之路
 * @author 是阿秋啊
 * @date 2022/05/19 14:30
 **/
public class da_guai_shou {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            int n = sc.nextInt();
            int a = sc.nextInt();
            int[] b = new int[n];
            for(int i = 0; i < n; i++) {
                int temp = sc.nextInt();
                if(temp <= a) {
                    a+=temp;
                }else{
                    a+=helper(a,temp);
                }
            }
            System.out.println(a);
        }
    }
    public static int helper(int a,int b) {
        if(b % a == 0) {
            return a;
        }
        int c;
        while (b > 0) {
            c = a % b;
            a = b;
            b = c;
        }
        return a;
    }
}